package org.kernely.directory;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.http.HttpService;

public class Activator implements BundleActivator {

	/**
	 * Called when the bundle is STARTING
	 */
	public void start(BundleContext pBundleContext) throws Exception {

		// Register images
		ServiceReference sRef = pBundleContext.getServiceReference(HttpService.class.getName());
		if (sRef != null)
		{
			HttpService service = (HttpService) pBundleContext.getService(sRef);
			service.registerResources("/directorybundle/images", "img", null);
		}		
	}

	/**
	 * Called when the Bundle is STOPPING
	 */
	public void stop(BundleContext arg0) throws Exception {

	}
}